#ifndef RAINDROP_H_N5928VBT
#define RAINDROP_H_N5928VBT

#include "cloud.h"
#include "util/color4f.h"
#include "util/vec3f.h"
#include "util/math_util.h"
#include "mover.h"

#define Y_THRESHOLD -10
#define Y_VELOCITY -0.6
#define MAX_COLOR_OFFSET 0.2
#define MAX_SIZE_OFFSET 0.3

class RainDrop : public Mover {
private:
    Color4f *myColor;
        
public:
    static const GLdouble mySize = 0.1;
        
    RainDrop (Vec3f startPos, Color4f *color) {
        myPos = startPos;
        myVel = Vec3f(0, Y_VELOCITY, 0);
        myColor = color; // This makes things really slow!!!
    }
    
    virtual ~RainDrop () {
        // Does not delete anything since myColor belongs to Rain
    }
    
    void draw() {
        GLfloat randomColorOffset = randFloatRange(0, MAX_COLOR_OFFSET);
        GLfloat randomSizeOffset = randFloatRange(0, MAX_SIZE_OFFSET);
        glPushMatrix();
            glTranslatef(myPos[0], myPos[1], myPos[2]);
            glBegin(GL_LINES);
                glColor4f((*myColor)[0] + randomColorOffset, 
                          (*myColor)[1] + randomColorOffset, 
                          (*myColor)[2] + randomColorOffset, 
                          (*myColor)[3]);
                
                glVertex3f(0, 0, 0);
                glColor4f((*myColor)[0] + randomColorOffset, 
                          (*myColor)[1] + randomColorOffset, 
                          (*myColor)[2] + randomColorOffset, 
                          (*myColor)[3] + 0.3);
                glVertex3f(0, -1 * (mySize + randomSizeOffset), 0);
            glEnd();
        glPopMatrix();
    }
    
    // void setColor(const Color4f newColor) {
    //     myColor.set(newColor);
    // }
    
    GLfloat getYPos() {
        return myPos[1];
    }
};

#endif /* end of include guard: RAINDROP_H_N5928VBT */
